package com.ikingtech.framework.sdk.pay.api;

import com.ikingtech.framework.sdk.base.model.BatchParam;
import com.ikingtech.framework.sdk.core.response.R;
import com.ikingtech.framework.sdk.pay.model.*;
import com.ikingtech.framework.sdk.web.annotation.PostRequest;
import com.ikingtech.framework.sdk.pay.model.*;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author tie yan
 */
public interface PayApi {

    @PostRequest(order = 1, value = "/order", summary = "支付下单", description = "支付下单")
    R<PayOrderDTO> order(@Parameter(name = "payment", description = "支付信息")
                         @RequestBody PaymentDTO payment);

    @PostRequest(order = 2, value = "/refund", summary = "退款", description = "退款")
    R<Object> refund(@Parameter(name = "refundParam", description = "退款参数")
                     @RequestBody PayRefundParamDTO refundParam);

    @PostRequest(order = 3, value = "/order/cancel", summary = "取消支付", description = "取消支付")
    R<Object> cancel(@Parameter(name = "cancelParam", description = "取消支付参数")
                     @RequestBody PaymentCancelParamDTO cancelParam);

    @PostRequest(order = 3, value = "/order/red-pack", summary = "发放红包", description = "发放红包")
    R<Object> redPack(@Parameter(name = "redPack", description = "红包")
                      @RequestBody PayRedPackDTO redPack);

    @PostRequest(order = 4, value = "/result/request-id", summary = "查询支付结果", description = "查询支付结果")
    R<PayRecordDTO> getPayResultByRequestId(@Parameter(name = "requestId", description = "请求编号")
                                            @RequestBody String requestId);

    @PostRequest(order = 4, value = "/result/list/request-ids", summary = "批量查询支付结果", description = "批量查询支付结果")
    R<List<PayRecordDTO>> listPayResultByRequestIds(@Parameter(name = "requestIds", description = "请求编号集合")
                                                   @RequestBody BatchParam<String> requestIds);
}
